/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * THIS FILE IS AUTOGENERATED BY arktscgen v2.1.9-arktscgen-6. DO NOT EDIT MANUALLY!
 * es2panda fe7c2bfd7c50a1bef62bcedaac78ba82000e6c39(2025-07-10) sdk v1.5.0-dev.36516
 */

import {
    global,
    passNode,
    passNodeArray,
    unpackNonNullableNode,
    unpackNode,
    unpackNodeArray,
    assertValidPeer,
    AstNode,
    KNativePointer,
    nodeByType,
    ArktsObject,
    unpackString
} from "../../reexport-for-generated"

import { ClassElement } from "./ClassElement"
import { Es2pandaAstNodeType } from "./../Es2pandaEnums"
import { Es2pandaModifierFlags } from "./../Es2pandaEnums"
import { Es2pandaOverloadDeclFlags } from "./../Es2pandaEnums"
import { Expression } from "./Expression"
import { Identifier } from "./Identifier"
import { SrcDumper } from "./SrcDumper"

export class OverloadDeclaration extends ClassElement {
    constructor(pointer: KNativePointer) {
        assertValidPeer(pointer, 54)
        super(pointer)
    }
    static createOverloadDeclaration(key: Expression | undefined, modifiers: Es2pandaModifierFlags): OverloadDeclaration {
        const result: OverloadDeclaration = new OverloadDeclaration(global.generatedEs2panda._CreateOverloadDeclaration(global.context, passNode(key), modifiers))
        result.setChildrenParentPtr()
        return result
    }
    static updateOverloadDeclaration(original: OverloadDeclaration | undefined, key: Expression | undefined, modifiers: Es2pandaModifierFlags): OverloadDeclaration {
        const result: OverloadDeclaration = new OverloadDeclaration(global.generatedEs2panda._UpdateOverloadDeclaration(global.context, passNode(original), passNode(key), modifiers))
        result.setChildrenParentPtr()
        return result
    }
    get flag(): Es2pandaOverloadDeclFlags {
        return global.generatedEs2panda._OverloadDeclarationFlagConst(global.context, this.peer)
    }
    get overloadedList(): readonly Expression[] {
        return unpackNodeArray(global.generatedEs2panda._OverloadDeclarationOverloadedList(global.context, this.peer))
    }
    /** @deprecated */
    setOverloadedList(overloadedList: readonly Expression[]): this {
        global.generatedEs2panda._OverloadDeclarationSetOverloadedList(global.context, this.peer, passNodeArray(overloadedList), overloadedList.length)
        return this
    }
    /** @deprecated */
    pushFront(overloadedExpression?: Identifier): this {
        global.generatedEs2panda._OverloadDeclarationPushFront(global.context, this.peer, passNode(overloadedExpression))
        return this
    }
    /** @deprecated */
    addOverloadDeclFlag(overloadFlag: Es2pandaOverloadDeclFlags): this {
        global.generatedEs2panda._OverloadDeclarationAddOverloadDeclFlag(global.context, this.peer, overloadFlag)
        return this
    }
    get isConstructorOverloadDeclaration(): boolean {
        return global.generatedEs2panda._OverloadDeclarationIsConstructorOverloadDeclaration(global.context, this.peer)
    }
    get isFunctionOverloadDeclaration(): boolean {
        return global.generatedEs2panda._OverloadDeclarationIsFunctionOverloadDeclaration(global.context, this.peer)
    }
    get isClassMethodOverloadDeclaration(): boolean {
        return global.generatedEs2panda._OverloadDeclarationIsClassMethodOverloadDeclaration(global.context, this.peer)
    }
    get isInterfaceMethodOverloadDeclaration(): boolean {
        return global.generatedEs2panda._OverloadDeclarationIsInterfaceMethodOverloadDeclaration(global.context, this.peer)
    }
    /** @deprecated */
    dumpModifier(dumper?: SrcDumper): this {
        global.generatedEs2panda._OverloadDeclarationDumpModifierConst(global.context, this.peer, passNode(dumper))
        return this
    }
    protected readonly brandOverloadDeclaration: undefined
}
export function isOverloadDeclaration(node: object | undefined): node is OverloadDeclaration {
    return node instanceof OverloadDeclaration
}
if (!nodeByType.has(Es2pandaAstNodeType.AST_NODE_TYPE_OVERLOAD_DECLARATION)) {
    nodeByType.set(Es2pandaAstNodeType.AST_NODE_TYPE_OVERLOAD_DECLARATION, (peer: KNativePointer) => new OverloadDeclaration(peer))
}
